﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity;
using DAL;
using Common;
using System.Data.Linq;
namespace BAL
{

    public class QuestionsUseNumber : BaseBAL<QuestionsUseNumberInfo, Models.QuestionsUseNumber>
    {
        public static void SaveQuestionsUseNumberInfo(int examId,DateTime useDateTime)
        {
            using (var db = DatabaseHelper.GetDashboardData())
            {
                IList<int> ids = Paper_Ques.GetQuesId(examId);
                foreach (var item in ids)
                {
                    QuestionsUseNumberInfo questionUseNumber = new QuestionsUseNumberInfo() { CreateDate = useDateTime, ExamPaperId = examId, QuestionId = item };
                    Add(questionUseNumber);
                }
            }
        }

        public static void DeleteQuestionsUseNumberInfo(int examId)
        {
            using (var db = DatabaseHelper.GetDashboardData())
            {
                db.ExecuteCommand("delete from  QuestionsUseNumber where ExamPaperId=" + examId.ToString());
            }
        }
    }
}
